package com.rx.mylist.service;


import lombok.extern.slf4j.Slf4j;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.CachePut;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

@Service
@Slf4j
public class ListCacheService {
    // CacheConfig.java 配置
    @Cacheable(cacheNames = "userinfo", key = "#token")
    public Object getData(String token){
        // 获取缓存中的token
        log.info("getData");
        return null;
    }

    @CachePut(cacheNames = "userinfo", key = "#token")
    public Object putData(String token,Object val){
        // 获取缓存中的token
        log.info("putData");
        log.info(val.toString());
        return val;
    }

    @Cacheable(cacheNames = "company", key = "#bid")
    public Object getCompanyData(String bid){
        // 获取缓存中的token
        //log.info("getData");
        return null;
    }

    @CachePut(cacheNames = "company", key = "#bid")
    public Object putCompanyData(String bid,Object val){
        // 获取缓存中的token
        //log.info("putData");
        //log.info(val.toString());
        return val;
    }

    @Cacheable(cacheNames = "home", key = "#bid")
    public Object getHomeData(String bid){
        // 获取缓存中的token
        //log.info("getData");
        return null;
    }

    @CachePut(cacheNames = "home", key = "#bid")
    public Object putHomeData(String bid,Object val){
        // 获取缓存中的token
        //log.info("putData");
        //log.info(val.toString());
        return val;
    }

    @CacheEvict(cacheNames = "home", key = "#bid")
    public void deleteHomeData(String bid) {

    }
}
